package test.library;

import test.library.behavior.*;

import java.util.Scanner;

public class Manager extends User{
    //构造方法
    public Manager(String name) {
        super(name);
        identity = "管理员";

        behaviors = new IBehavior[]{
                new PrintBookList(),
                new FindBook(),
                new AddBook(),
                new DeleteBook()
        };
    }

    @Override
    public int menu() {
        System.out.println("-----------------------");
        System.out.println("欢迎您,"+ identity + name +"!");
        System.out.println("1.查阅书单");
        System.out.println("2.搜索书籍");
        System.out.println("3.添加书籍");
        System.out.println("4.删除书籍");
        System.out.println("-----------------------");
        System.out.print("请选择要进行的操作:");
        Scanner scanner = new Scanner(System.in);
        int input = scanner.nextInt();
        if (input <= 4 && input >= 1){
            return input;
        }else{
            System.out.println("输入错误,请重新输入");
            menu();
            return 0;
        }
    }

}
